package com.zpark.cloud.alibaba.controller;

import com.zpark.cloud.alibaba.entity.Dept;
import com.zpark.cloud.alibaba.service.IDeptService;
import com.zpark.cloud.alibaba.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @PackageName: com.zpark.cloud.alibaba.controller
 * @ClassName: DeptController
 * @Description:
 * @author: RZS
 * @date: 2023/6/21  15:11
 */
@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private IDeptService deptService;

    @GetMapping("/find_by_id/{id}")
    public ResponseResult<Dept> findById(@PathVariable("id") Integer id){
        return new ResponseResult<>(200, "SUCCESS", deptService.findById(id));
    }

    @GetMapping("/find_all")
    public ResponseResult<List<Dept>> findAll(){
        return new ResponseResult<>(200, "SUCCESS", deptService.findAll());
    }
}
